#pragma once

#include <io/rttI2C.h>

class spl0601: public NXMFC::rttI2C
{
public:
    spl0601();
    ~spl0601();

    bool init();
    float pressure(void);
    float pressureToAltitude(float pressure);
    float temperature();

    bool rawPressure(int32_t &p);//for test
    bool rawTemperature(int32_t &raw);

private:
    void setRate(uint8_t sensor, uint8_t samplerate, uint8_t oversample);
    bool writeReg(uint8_t addr, uint8_t val);
    uint8_t readReg(uint8_t addr);
    bool getCalibParam(void);

private:
    int32_t i32kT;
    int32_t i32kP;
    int16_t c0;
    int16_t c1;
    int32_t c00;
    int32_t c10;
    int16_t c01;
    int16_t c11;
    int16_t c20;
    int16_t c21;
    int16_t c30;
    float temp;
    int32_t temperature_raw;
};
